<?php
/***********************************************************************
 * @package    	IvanEngine
 * @subpackage 	Core
 * @author     	Ivan <ivanzx@msn.com>
 * @created    	2010-05-17
 ***********************************************************************/
if(defined("IVANENGINE_CORE_VALIDATOR_CALLBACK"))
	die("Redefinition macro in :".__FILE__."(".__LINE__.")");
define("IVANENGINE_CORE_VALIDATOR_CALLBACK", true);

require_once (dirname(__FILE__).'/ValidatorBase.php');

class CValidatorCallback extends CValidatorBase
{
	const RO_Callback	= 'RO_Callback';
	const NO_Arguments	= 'NO_Arguments';
	
	protected function Initialize($options = array(), $messages = array())
  	{
    	$this->AddRequiredOption(self::RO_Callback);
    	$this->AddOption(self::NO_Arguments, array());

    	$this->SetOption(self::NO_Required, false);
  	}

  	protected function DoVerify($value)
  	{
    	return call_user_func($this->GetOption(self::RO_Callback), $this, $value, $this->GetOption(self::NO_Arguments));
  	}
}

?>